The present invention relates to a subject image extraction method and apparatus for extracting a desired subject image from an image.
In the image of a commodity on a catalog, advertisement, or the like, a desired commodity region alone is often extracted by erasing the surrounding background portion. Image processing software that implements such processing on a computer is known.
As a method of automatically extracting a desired subject region from image data by digital image processing on a computer, a method of extracting regions having nearly equal hue values as a desired subject region while paying attention to hue information included in the desired subject region, a method of preparing two images, i.e., an image of a background alone, and an image including both a subject and the background, and extracting the subject region on the basis of difference information between these two images, and the like are available. However, in either method, the contour of the extracted image region is incomplete, and correction of the contour is indispensable.
Conventionally, in order to correct a contour on a computer, a method of erasing a contour portion to be corrected by an erasing tool such as an eraser, and thereafter, manually re-drawing a new contour using a pointing device such as a mouse, a method of correcting a contour by changing the shape of a fitting curve, which is generated based on the automatically extracted contour to shape the contour, by dragging and moving the position to be corrected using a mouse, and the like are used.
However, both methods require user""s manual correction using the pointing device, resulting in much cumbersome operations. It is, in fact, very hard to smoothly draw a complicated shape or linear shape using a mouse or the like, and incomplete contour portions often remain uncorrected.
It is an object of the present invention to provide a subject image extraction method and apparatus, which can solve the conventional problems, and can accurately correct the contour of an extracted subject region.
It is another object of the present invention to provide a subject image extraction method and apparatus, which can easily correct the contour of an extracted subject region.
It is still another object of the present invention to provide a subject image extraction method and apparatus, which can locally correct a contour by simple operation.
It is still another object of the present invention to provide a subject image extraction method and apparatus, which can correct the contour of the subject region with a high degree of freedom.
A subject image extraction method or apparatus according to the present invention comprises: subject region mask generation step or means for generating a subject region mask for masking a region of a subject image on the basis of an input image including the subject image; contour shaping step or means for shaping a contour of the subject region mask; local region setting step or means for setting local regions for correcting the contour shaped by the contour shaping step or means on the basis of information of the contour of the subject region mask before and after shaping by the contour shaping step or means; and contour correction step or means for correcting the contour of the subject region mask shaped by the contour shaping step or means within the local regions set by the local region setting step or means.
According to the method or apparatus with the above arrangement, since the local regions to be subjected to contour correction are automatically set in the vicinity of the subject region mask, and correction is executed, contour correction can be accurately and quickly executed. Since sample points for contour shaping are set in accordance with the direction of the contour of the subject region mask, many sample points can be set at points where the direction of the contour changes, and flexible extraction for the contour of a complicated shape can be done.
A subject image extraction method or apparatus according to the present invention comprises: region segmentation step or means for segmenting an input image into a plurality of small regions; labeling step or means for assigning labels to the small regions obtained by the region segmentation step or means to identify them; subject region mask generation step or means for generating a desired subject region mask from the input image; contour shaping step or means for shaping a contour of the subject region mask generated by the subject region mask generation step or means; display step or means for displaying the contour of the subject region mask shaped by the contour shaping step or means to be superimposed on the input image; correction point designation step or means for designating correction points of the contour of the subject region mask shaped by the contour shaping step or means on the displayed image; and contour correction step or means for correcting the contour of the subject region mask by executing local processing in units of labels including the points designated by the correction point designation step or means.
Since local processing is automatically executed in units of labels including points designated upon contour correction, the correction points need not be designated in units of pixels, and the contour need not be manually corrected. As a result, no manual, complicated processing is required, and the contour can be easily corrected.
A subject image extraction method or apparatus according to the present invention comprises: subject region mask generation step or means for generating a desired subject region mask from an input image; display step or means for displaying a contour of the subject region mask generated by the subject region mask generation step or means to be superposed on the input image; local region setting step or means for setting an arbitrary local region for correcting the contour of the subject region mask on a display screen; processing selection step or means for selecting processing to be done in the local region; and correction step or means for correcting the subject region mask in the local region in accordance with the processing selected by the processing selection step or means.
Since desired contour correction can be automatically executed by only selecting a proper tool and roughly setting a region to be corrected in correspondence with the processing contents of contour correction, accurate contour correction can be executed quickly.
Preferably, a local region to be subjected to contour correction is automatically set in the vicinity of the subject region mask to execute correction. In this manner, contour correction can be accurately and quickly executed.
Also, a desired subject region mask is preferably generated on the basis of difference information between a subject image and background image. With this processing, highly reliable, accurate subject extraction can be done.
Sample points for contour shaping are preferably set in accordance with the direction of the contour of the subject region mask. With this processing, since many sample points can be set at points where the direction of the contour changes, flexible extraction for the contour of a complicated shape can be done.
Since the user can arbitrarily select the processing to be executed, various types of subject contours can be flexibly corrected, thus improving extraction accuracy.
Since a local region can be easily set by operating a pointing means, and processing within the local region is done using operation information, correction can be executed at natural intervals.
Other features and advantages of the present invention will be apparent from the following description taken in conjunction with the accompanying drawings, in which like reference characters designate the same or similar parts throughout the figures thereof.